/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package MODEL;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;
import java.util.Observer;

/**
 *
 * @author Irene
 */
public class EventHandler extends Observable implements Observer, Serializable {

    private List<Event> events;
    private Event activeEvent;

    public EventHandler() {
        events = new ArrayList<Event>();
    }

    public void addEventToList(Event e) {
        events.add(e);
        setChanged();
        notifyObservers();

        e.addObserver(this);
    }

    public void removeEventFromList(Object event){
        events.remove(event);
         setChanged();
        notifyObservers();

    
    }

    public List<Event> getEvents(){
    return events;
    }

    public Event getActiveEvent(){
    return activeEvent;
    }

    public void setActiveEvent(Event event){
    activeEvent = event;
        setChanged();
        notifyObservers();
    }

    public void update(Observable o, Object arg) {
        setChanged();
        notifyObservers();
    }




}
